package log

import (
	"gitee.com/hexug/go-tools/ioc"
	"gitee.com/hexug/go-tools/logger"
)

func init() {
	ioc.Container.RegisterConf(NewLog())
}

const ConfName = "log"

func (l *Log) Name() string {
	return ConfName
}

func (l *Log) Init() error {
	logger.PrintConsole = l.PrintConsole
	logger.Level = l.Level
	logger.SaveFile = l.SaveFile
	logger.DirPath = l.SaveFileDir
	logger.ShowFullPath = l.ShowFullPath
	logger.Separator = l.Separator
	logger.PathMsgSeparator = l.PathMsgSeparator
	logger.UseJSONFormat = l.UseJSONFormat
	logger.Update()
	return nil
}
